package com.recyclebanner;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;
import java.util.Map;

/**
 * 无限循环适配器
 * Created by cys on 2015/11/4.
 */
public class RecycleBannerAdapter extends  InfinitePagerAdapter{
    private List list;
    private InitRecycleViewpager.BannerItemResponse itemClickPostion;
    private  int resId=0;
    public void setItemClickPostion(InitRecycleViewpager.BannerItemResponse itemClickPostion) {
        this.itemClickPostion = itemClickPostion;
    }

    private Context context;
    public   RecycleBannerAdapter(int resId ,List list,Context context){
        this.list=list;
        this.context=context;
        this.resId=resId;
    }
    @Override
    public int getItemCount() {
        return list.size();
    }

    @Override
    public View getView(int position, View convertView, ViewGroup container) {
            if (convertView==null){
                convertView= LayoutInflater.from(context).inflate(resId,null);
            }
        if (itemClickPostion!=null)
        itemClickPostion.responseData(convertView, position);

        return convertView;
    }
}
